﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using EncuentraloSilverlight.Models;
using System.Runtime.Serialization;

namespace EncuentraloSilverlight.Web.Models
{
    public partial class Category
    {

        public bool IsValid
        {
            get { return (GetCategoryRuleViolations().Count() == 0); }
        }

        public IEnumerable<RuleViolation> GetCategoryRuleViolations()
        {
            if (String.IsNullOrEmpty(Name))
                yield return new RuleViolation("Category name required","Name");
            yield break;
        }

    }
}